<script type="text/html" id="field_item">
    {{each fields field}}
    <li>
        <input type="checkbox" class="checkboxs" id="tyue-checkbox-blue-{{field}}"/>
        <label for="tyue-checkbox-blue-{{field}}"></label>
        <span>{{field}}</span>
    </li>
    {{/each}}
</script>

<div class="fields">
    <div class="selection-container">
        <div class="select-box left">
            <div class="select-box-title">
                <input type="checkbox" class="checkbox-all" id="checkbox-all1"/>
                <label for="checkbox-all1"></label>
                <span>选中字段</span>
            </div>
            <div class="select-content">
                <ul class="unselect-ul selected-fields">

                </ul>
            </div>
        </div>
        <div class="arrows-box">
            <div class="arrow-btns">
                <button class="arrow-btn right">
                    &#8250;
                </button>
                <button class="arrow-btn left">
                    &#8249;
                </button>
            </div>
        </div>
        <div class="select-box right">
            <div class="select-box-title">
                <input type="checkbox" class="checkbox-all" id="checkbox-all2"/>
                <label for="checkbox-all2"></label>
                <span>所有字段</span>
            </div>
            <div class="select-content">
                <ul class="selected-ul form-fields">

                </ul>
            </div>
        </div>
    </div>
</div>

<script>
    // var fields = [];

    var tpml = template.compile($("#field_item").html());
    //load
    // $.get("/api/bpm/form/one",{id: window.opener.$("#selectForm").val()}, function (msg) {
    //     if(!msg.success){
    //         return
    //     }
    //     $.each(msg.data.form.data ||[], function (i,v) {
    //         fields.push(msg.data.name + ":" + v.title)
    //     })
    //     initFields()
    //
    // },'json');


    console.log(opener.fields)
    $(".form-fields").html(tpml({
        fields: opener.fields
    }))


</script>

